package org.yu.api.register;

import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;

public record TranslationBean(String key, String value) {
    public final static Codec<TranslationBean> CODEC = RecordCodecBuilder.create(translateBeanInstance -> translateBeanInstance.group(
            Codec.STRING.fieldOf("key").forGetter(TranslationBean::key),
            Codec.STRING.fieldOf("value").forGetter(TranslationBean::value)
    ).apply(translateBeanInstance, TranslationBean::new));

    public TranslationBean copy() {
        return new TranslationBean(key, value);
    }

    public TranslationBean newValue(String newValue) {
        return new TranslationBean(key, newValue);
    }
}
